<?php

//引入阿里大雨的sdk
include_once ('../simplewind/Core/Library/Org/TaobaoSdk/TopSdk.php');

/**
 * 短信功能类库, 移植自摇一摇项目内的sms
 * @author pufan
 */
class sms {
    //
    function sendMsg($templateCode, $phone_num, $smsParam, $signName = '抱抱堂') {
        $c = new \TopClient;
        $c->appkey = '23283987';
        $c->secretKey = '43b88dd8ee34c3f17c1104b80960b0d0';
        
        $req = new \AlibabaAliqinFcSmsNumSendRequest;
        $req->setExtend("123456");
        $req->setSmsType("normal");
        $req->setSmsFreeSignName($signName);
        $req->setSmsParam(json_encode($smsParam));
        $req->setRecNum($phone_num);
        $req->setSmsTemplateCode($templateCode);
        $resp = $c->execute($req);
        return $resp->{'result'}->{'err_code'};
        var_dump($resp->{"code"});
    }
}
